<div class="site-tree">
    <ul class="layui-nav layui-nav-tree">
        <li id="nav-user-manager" class="layui-nav-item">
            <a href="javascript:change(0);">
                <cite>用户列表</cite>
            </a>
        </li>
        <li id="nav-role-manager" class="layui-nav-item">
            <a href="javascript:change(1);">
                <cite>角色列表</cite>
            </a>
        </li>
    </ul>
</div>
<script>
    var parentUrl = window.parent.document.URL;
    var targetId = '';
    var current_page = 0;
    if (parentUrl.indexOf("UserManager") > 0) {
        targetId = "nav-user-manager";
        current_page = 0;
    } else if (parentUrl.indexOf("RoleManager") > 0) {
        targetId = "nav-role-manager";
        current_page = 1;
    }
    console.log(window.parent.document.URL)
    var target_className = document.getElementById(targetId).className;
    target_className +=  " layui-this";
    document.getElementById(targetId).className = target_className;

    function change(position) {
        if (current_page == position) return;

        switch (position) {
            case 0:
                window.parent.location.href='../member_manager/UserList.html';
                break;
            case 1:
                window.parent.location.href='../member_manager/RoleList.html';
                break;
        }
    }
</script>